HIT L2: added data transformation into 10-minute chunks to L2 - #3377
HIT L2: added data transformation into 10-minute chunks to L2#3377leowerneck wants to merge 7 commits into
Conversation
tmplummer
left a comment
There was a problem hiding this comment.
A few things to consider.
tmplummer
left a comment
There was a problem hiding this comment.
This looks good to me.
jtniehof
left a comment
There was a problem hiding this comment.
There are some general comments still to address scattered throughout the conversation.
Overall this looks good. Two things:
- Can the test of the time transformation be ported over from L3? There are no test updates in this PR, which makes me nervous
- Can you do an end-to-end test of making an L2 with this new code, making an L3 with that output, and comparing to the existing L3? That will I think be the acid test.
Co-authored-by: Tim Plummer <timothy.plummer@lasp.colorado.edu>
…e names around transformation algorithm
10d8dfd to
06f97b7
Compare
Fair point. I added
I used Claude (sorry for the verbosity) to create a convincing (at least to the untrained eye, like mine) end-to-end test in this repo. Here's what you need to run (also found in the repo's git clone https://github.com/leowerneck/L2_L3_acid_test.git
cd L2_L3_acid_test
./run_test.shIf you also see "PASS", that would be reassuring. Let me know if there's anything missing from the test that you would like to see. |
|
I'd feel more confident in something where we set up dependency .json and just ran imap_cli to make the files, so we're doing a full end-to-end on the actual files instead of transforming the L2 and just looking at the Python objects. I can take a stab later this afternoon. |
imap-data-access download imap_hit_l2_macropixel-intensity-ed398e36-635a606f_20260819_v001.0003.json
#rename imap_hit_l2_macropixel-intensity-test_20260819_v001.0004.json, change minor version to 4
imap-data-access download imap_hit_l3_macropixel_20260819_v001.0005.cdf # for comparison
imap-data-access download imap_hit_l3_macropixel-6bf00ff0-1e59d123_20260819_v001.0005.json
# rename imap_hit_l3_macropixel-test_20260819_v001.0006.json, change minor version to 6, change minor version of input l2 to 4
imap_cli --instrument hit --data-level l2 --descriptor macropixel-intensity --start-date 20260819 --dependency imap_hit_l2_macropixel-intensity-test_20260819_v001.0004.json
python3 ./imap_l3_data_processor.py --instrument hit --data-level l3 --descriptor macropixel --start-date 20260819 --dependency imap_hit_l3_macropixel-test_20260819_v001.0006.json
cdfcompare -nonumber -noetc imap_hit_l3_macropixel_20260819_v001.0005.cdf imap_hit_l3_macropixel_20260819_v001.0006.cdfResults are good: In these 15 records, the old epoch was 1 microsecond later (greater) than the new epoch. So there's probably some rounding going on involving use of datetimes. I generally prefer to do the math straight in TT2000 for that reason, but I don't think it's important in this case. However it might impact IMAP-Science-Operations-Center/imap_L3_processing/issues/121 The difference in |
|
I created this repo which contains a helper to run the test you suggested in an automated way. This was a great exercise to understand how the pipeline runs, so thanks for the example! Is updating the L2 file required by the Hit integration test (see imap_L3_processing::#161) something I can do, or is something I need to ask someone else to do? |
I think you should be able to do that. If you can chase down the dependency file used for that L2 and just run it again with the new code, that might be most straightforward. Any thoughts on the microsecond offset? If it's possible to easily squash that it would give me warm fuzzies, but probably not essential. |
The mismatch is explained by how the midpoint is computed. The old L3 code averaged I can change the new L2 code to match the old L3 code, but I just want to double check that the "round-then-average" approach in the old L3 (versus the "average-then-round" in the new L2) is the expected one. |
Change Summary
Closes #3327.
Overview
This PR moves the HIT macropixel 10-minute chunk transformation from L3 to L2. It coordinates with PR 161 in
imap_L3_processingthat closes issue 143 of that repository.The L2 macropixel product now consolidates the ten one-minute packetized records into a single record for each 10-minute
integration period. It also assigns the integration midpoint as the epoch and provides five-minute
DELTA_MINUSandDELTA_PLUSvalues throughepoch_delta.File changes
The following changes were made:
imap_processing/hit/l2/hit_l2.pytransform_to_10_minute_chunks.combinations.
epoch_deltafor each record.process_macropixel_intensityto return the transformed dataset.epoch_deltafor bothDELTA_MINUS_VARandDELTA_PLUS_VAR.imap_processing/cdf/config/imap_constant_attrs.yamlepoch_delta.Testing
Ran the focused HIT L2 test suite:
All 17 tests passed.